import java.util.Arrays;

public class Reverse {
    //数组逆序
    public static void swap(int[] array,int i, int j){
        int tmp = array[i];
        array[i] = array[j];
        array[j] = tmp;
    }

    public static void reverse(int[] array){
        int left = 0;
        int right = array.length - 1;
        while (left < right){
            swap(array,left,right);
            left++;
            right--;
        }
    }

    public static void main(String[] args) {
        int[] array = {1,2,3,4,5,6};
        reverse(array);
        System.out.println(Arrays.toString(array));
    }
}
